<?php

    define('ABSOLUTE_SERVER_REMOTE_ADDR','../../');
    define('ABSOLUTE_SERVER_DOCUMENT_ROOT','../../');

    if(file_exists('../../../definitions.inc.php')) include_once('../../../definitions.inc.php');
    include(ABSOLUTE_SERVER_DOCUMENT_ROOT.'session.inc');
    require_once(ABSOLUTE_SERVER_DOCUMENT_ROOT.'funct.inc');
    if(!GetAdminID($ID)){echo"Nie ste korektne prihlaseni a nemate administracne� prava.";exit;}
    if(!Right_Check(5)){header('Location:'.ABSOLUTE_SERVER_DOCUMENT_ROOT.'error.php');exit;}   
    require_once(ABSOLUTE_SERVER_DOCUMENT_ROOT.'functs.inc');
    require_once('adm_informations.inc');
    include ABSOLUTE_SERVER_DOCUMENT_ROOT.'color_style.php';
    include ABSOLUTE_SERVER_DOCUMENT_ROOT.LANGUAGE;
        
    require_once('../../../classDB.inc.php');
    
    $_DB = new classDB();
    if (!$_DB->open()){echo OPEN_DB_ERR; break;}
?>
<html>

<head>
	<?php echo '<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET_.';">'; ?>
	<?php
		//include ABSOLUTE_SERVER_DOCUMENT_ROOT.'html_style.php';
	?>
	<style  type="text/css"><!--
		table{
            border-bottom-color: black;
            border-top-color: black;
            border-left-color: black;
            border-right-color: black;
            border-collapse: collapse;
            font-size: 10px;
            font-family:  verdana;
        }
        form {margin-top:0pt; margin-bottom:0px;}
        img {margin-top:0pt; margin-bottom:0px;}
        body{
            margin-left:10px;
            margin-right:0pt;
            margin-top:0pt;
            margin-bottom:0pt;
            font-family:  verdana;
            font-size: 10px;
        }
        input {
            border: 1px solid black;
            cursor: hand;
            background-color: white;
            font-size: 10px;
            margin-left: 0px;
            padding-left: 0px;
            list-style-type: none;
            font-family:  Verdana;
        }
        a {
		  	text-decoration: none; 
		  	font-weight: normal; 
		  	color:black; 
		  	font-size:10;
		}
		a:hover {
		  	text-decoration: underline; 
			font-weight: normal; 
			color:#808080; 
			font-size:10;
		}
		textarea{
			width:600px;
			height:600px;
		}
    --></style>

<!-- TinyMCE -->
<script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
        
        relative_urls : false,
		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,image,cleanup,code,|,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User2",
			staffid : "991234"
		}
	});
</script>
<!-- /TinyMCE -->
    
    <script type="text/javascript">
        function fileBrowserCallBack(field_name, url, type, win) {
            // This is where you insert your custom filebrowser logic
            alert("Example of filebrowser callback: field_name: " + field_name + ", url: " + url + ", type: " + type);

            // Insert new URL, this would normaly be done in a popup
            win.document.forms[0].elements[field_name].value = "someurl.htm";
        }

        function Refresh_List_News(){
            window.open("adm_informations_big_news.php","news","");
        }

        function Refresh_List_Menu(){
            <?php
                echo "window.open(\"adm_informations_big_menu.php?roll_menu=".$_REQUEST["roll_menu"]."\",\"menu\",\"\");";
            ?>
        }

    </script>

</head>

<?php
	$Type_ID	= $_REQUEST['Type_ID'];
	$Type		= $_REQUEST['Type'];
	

	
do{	
	//nastaveni body
	if($_REQUEST['save']=="YES"){
		if($Type=="MENU")
			print "<body bgcolor=\"".BACKGROUND_IN_TABLE."\"  onLoad=\"javascript:Refresh_List_Menu();\">";
		if($Type=="NEWS")
			print "<body bgcolor=\"".BACKGROUND_IN_TABLE."\"  onLoad=\"javascript:Refresh_List_News();\">";
	}
	else
		print "<body bgcolor=\"".BACKGROUND_IN_TABLE."\">";	
	
	if(($Type_ID=="") or ($Type=="")) break;
	
	if($_REQUEST['save']=="YES")
    	{
    		mysql_query("DELETE FROM top_menu_text WHERE ((Type_ID=$Type_ID) AND (Type='$Type'))");
    	  	mysql_query("INSERT INTO top_menu_text (Type_ID,Type,Value,Value_Clear) 
			  				VALUES ($Type_ID,'$Type','".$_REQUEST["I_Text"]."','".trim(html_entity_decode(strip_tags($_REQUEST["I_Text"])))."') ");
    	  	update_caption($Type_ID,$Type,$_REQUEST["information_caption"]);
			
    	  	print "
			  	<center>
					<font style=\"font-family:verdana; font-size:18px; color:red;background-color:yellow;\">
						<br />
						<b>".UTM_TEXT_BOL_ULOZENY."</b>
						<br />
					</font>
				</center>
			";			
    	  	
      	}
      	
    
    
	print "
	<br />
	<br />
	<center>
		<form action=\"adm_informations_big_text.php\" target=\"contents\" method=\"post\">
		
			<input type=\"submit\" value=\"".UTM_ULOZIT."\" style=\"width :133px; background-color: ".BUTTON_ON_OUT.";\"
		        onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
		        onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
			
			<br />
			<br />
			
			<input type=\"text\" name=\"information_caption\" style=\"width:500px;\" value=\"".get_caption($Type_ID,$Type)."\" />
			
			<textarea name=\"I_Text\" wrap=\"on\" style=\"width:650px;\">".generate_info($Type_ID,$Type)."</textarea>
			<br />
			<input type=\"hidden\" value=\"$Type_ID\" name=\"Type_ID\" />
		    <input type=\"hidden\" value=\"$Type\" name=\"Type\" />
			<input type=\"hidden\" name=\"save\" value=\"YES\" />
			<input type=\"hidden\" value=\"".$_REQUEST["roll_menu"]."\" name=\"roll_menu\" />
		    <input type=\"submit\" value=\"".UTM_ULOZIT."\" style=\"width :133px; background-color: ".BUTTON_ON_OUT.";\"
		        onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\";
		        onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />
		</form>
	</center>
	";
	

  
	mysql_close();
}while(false)
?>


</body>
</html>